#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int a[50] = { 0 };
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	int delete = 0;
	scanf("%d", &delete);
	int i = 0, j = 0;
	while (i < n)
	{
		if (a[i] != delete)
		{
			a[j] = a[i];
			i++; j++;
		}
		else i++;
	}
	n = j;
	for (int i = 0; i < n; i++)
	{
		printf("%d ", a[i]);
	}
	return 0;
}